$(function(){
//立即执行以下内容
function UrlSearch() 
{
   var name,value; 
   var str=location.href; //取得整个地址栏
   var num=str.indexOf("?") 
   str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]

   var arr=str.split("&"); //各个参数放到数组里
   for(var i=0;i < arr.length;i++){ 
    num=arr[i].indexOf("="); 
    if(num>0){ 
     name=arr[i].substring(0,num);
     value=arr[i].substr(num+1);
     this[name]=value;
     } 
    } 
} 
var Request=new UrlSearch(); //实例化
var list_page_now='list_page'+Request.list_page;
document.getElementById(list_page_now).className = 'btn btn-white  active';
//立即执行结束
});
function list_page_go(list_page) 
{
   var list_page_url='index.php?m=help&c=help_admin&a=admin_help_list&list_page='+list_page;
   self.location=list_page_url;
}
function list_page_to() 
{
   var list_page = $('#list_page_to').val();
   var list_page_url='index.php?m=help&c=help_admin&a=admin_help_list&list_page='+list_page;
   self.location=list_page_url;
}
function sousuo() 
{
   var sousuokey = $('#sousuokey').val();
   var list_page_url='index.php?m=help&c=help_admin&a=admin_help_list&sousuokey='+sousuokey;
   self.location=list_page_url;
}
function admin_help_add(){
	layer.open({
	type: 2,
	title: '添加新帮助',
	maxmin: true,
	shadeClose: true, //点击遮罩关闭层
	area : ['360px' , '300px'],
	content: 'index.php?m=help&c=help_admin&a=admin_help_add',
	end: function () {
                location.reload();
            }
	});
}
function admin_help_edit(help_id){
	layer.open({
	type: 2,
	title: '修改帮助内容',
	maxmin: true,
	shadeClose: true, //点击遮罩关闭层
	area : ['360px' , '300px'],
	content: 'index.php?m=help&c=help_admin&a=admin_help_edit&help_id='+help_id,
	end: function () {
                location.reload();
            }
	});
}
function admin_help_del(help_id){
	toastr.options = {
			  "closeButton": true,
			  "debug": false,
			  "progressBar": true,
			  "positionClass": "toast-bottom-full-width",
			  "onclick": null,
			  "showDuration": "400",
			  "hideDuration": "1000",
			  "timeOut": "7000",
			  "extendedTimeOut": "1000",
			  "showEasing": "swing",
			  "hideEasing": "linear",
			  "showMethod": "fadeIn",
			  "hideMethod": "fadeOut"
			}
	var admin_help_del_do = $.ajax({
               type: "POST",
               url: "index.php?m=help&c=help_admin&a=admin_help_del_do",
               data: "help_id="+help_id,
               async: false
            }).responseText;
			if (admin_help_del_do == "1"){
				toastr.info("帮助删除失败！");
				self.location.reload();
			} else if (admin_help_del_do == "2") {
				toastr.success("成功删除 ID 为："+help_id+" 的帮助！");
				self.location.reload();
			} else {
				toastr.error("请勿提交非法数据！");
				self.location.reload();
			}
}